import React, { Component } from 'react';
import '../../styles/MyEntry.css'
import {index_nav} from '../../api/home'
// import pic from '../../assets/1.png'
class MyEntry extends Component {
    constructor(props){
        super(props)
      this.state={
        list:[] 
      }
    }
    componentDidMount(){
      //10类的分类列表请求
      index_nav().then((res)=>{
        // console.log(res.data.list);
        this.setState({
          list:res.data.list
        })
      })
    }
    render() {
        return (
            <div className='entrylist'>
              {this.state.list.length!=0?
                this.state.list.map((item,index)=>{
                    return (
                        <figure key={index}>
                  <div> <img src={item.pic} alt="" /></div>
                   <figcaption>{item.name}</figcaption>
                    </figure>                   
                    )
                }):<div className='empty'>没有更多数据啦~请重新加载</div>
              }
            </div>
        );
    }
}

export default MyEntry;
